@use '../base/mixins' as mixins;

a, button {
  // Reset style of buttons and anchors.
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  font-weight: 400;

  &.filled-button, &.icon-button, &.text-button, &.outlined-button {
    // Reset style of buttons.
    user-select: none;
    padding: 0;

    // Shared layout styles.
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    border-radius: var(--site-radius);
    width: fit-content;
    white-space: nowrap;
    font-family: var(--site-ui-fontFamily);
    font-size: 1rem;
    outline-offset: 2px;

    &.hidden {
      display: none;
    }

    &:hover {
      @include mixins.interaction-style(6%);
      text-decoration: none;
    }

    &:active {
      @include mixins.interaction-style(10%);
      text-decoration: none;
    }

    &:focus-visible {
      outline: 2px solid var(--site-primary-color);
    }
  }

  &.filled-button, &.outlined-button, &.text-button {
    padding: 0.25rem 0.75rem;
    gap: 0.4rem;

    // A larger call-to-action button.
    &.large-button {
      padding: 0.6rem 1.2rem;
      font-size: 1.5rem;
      gap: 0.75rem;
    }
  }

  &.filled-button {
    background-color: var(--site-filledButton-bgColor);
    color: var(--site-filledButton-fgColor);
    outline-offset: 2px;

    // Ensure color takes precedence over other anchor styling.
    &, &:hover, &:focus, &:active {
      color: var(--site-filledButton-fgColor);
    }

    span.material-symbols {
      font-variation-settings: 'FILL' 1;
      font-size: 20px;
    }

    code {
      background-color: var(--site-inset-bgColor-translucent-extra);
      border-color: transparent;
    }
  }

  &.icon-button {
    border-radius: 2rem;
    padding: 0.25rem;
    color: var(--site-base-fgColor-alt);
    text-decoration: none;

    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    background: none;

    > span {
      font-size: 1.5rem;
    }

    &:hover {
      color: var(--site-base-fgColor);
    }
  }

  &.text-button, &.outlined-button {
    // Ensure color takes precedence over other anchor styling.
    &, &:hover, &:active, &:focus {
      // TODO(parlough): Should this be primary color instead?
      color: var(--site-base-fgColor-lighter);
    }
  }

  &.outlined-button {
    border: 1px solid var(--site-outline);
  }
}
